<template>
  <view class="application">
    <u-card
      :border="false"
      :foot-border-top="false"
      :head-border-bottom="false"
      border-radius="0"
      class="lz-card"
      margin="0"
      padding="0"
    >
      <view slot="body">
        <view class="lz-card-body-title">{{$t('电子印章管理')}}</view>
        <u-grid :border="false" :col="5" class="lz-grid">
          <u-grid-item v-for="(item, index) in sealList" :key="index" @click="navigetTo(item)">
            <view :class="item.code" :style="item.color" class="iconfont lz-grid-iconfont"></view>
            <view class="grid-text">{{ item.name }}</view>
          </u-grid-item>
        </u-grid>
      </view>
    </u-card>
    <u-no-network></u-no-network>
  </view>
</template>

<script>
import { mapGetters, mapMutations } from 'vuex'

export default {
  computed: {
    ...mapGetters(['userInfo', 'api'])
  },
  data() {
    return {
      sealList: [
        {
          code: 'icon-jilu',
          color: 'background:#55ff7f',
          groupId: 3,
          groupName: '电子印章管理',
          id: 4,
          name: '申请用章',
          type: 1,
          url: '../electronUsageRecord/electronUsageRecord'
        },
        {
          code: 'icon-jilu',
          color: 'background:#FBCE24',
          groupId: 3,
          groupName: '电子印章管理',
          id: 1,
          name: '盖章记录',
          type: 1,
          url: '../electronUsageRecord/electronUsageRecord'
        },
        {
          code: 'icon-jilu',
          color: 'background:#4CD7CD',
          groupId: 3,
          groupName: '电子印章管理',
          id: 2,
          name: '电子印章',
          type: 1,
          url: '../electronicSealList/electronicSealList'
        },
        {
          code: 'icon-jilu',
          color: 'background:#FD9152',
          groupId: 3,
          groupName: '电子印章管理',
          id: 3,
          name: '合同管理',
          type: 1,
          url: '../contractManagement/contractManagement'
        }
      ]
    }
  },
  onLoad() {
    uni.setNavigationBarTitle({ title: this.$t('电子印签') })
  },
  methods: {
    //点击宫格
    navigetTo(item) {
      if (item.name === '盖章记录') {
        uni.navigateTo({
          url: '/pages/electronicSeal/electronUsageRecord/electronUsageRecord?name=' + item.name
        })
      } else if (item.name === '电子印章') {
        uni.navigateTo({
          url: '/pages/electronicSeal/electronicSealList/electronicSealList?name=' + item.name
        })
      } else if (item.name === '合同管理') {
        uni.navigateTo({
          url: '/pages/electronicSeal/contractManagement/contractManagement?name=' + item.name
        })
      } else if (item.name === '申请用章') {
        uni.navigateTo({
          url: '/pages/electronicSeal/applicationSeal/applicationSeal?name=' + item.name
        })
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.application {
}
</style>
